package com.thermofisher.beans;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * <p>
 *
 * </p>
 *
 * @author py
 * @since 2020-01-13
 */
@TableName("actual_amount")
public class ActualAmount extends Model<ActualAmount>
{

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private BigDecimal booking;

    private BigDecimal revenue;

    @TableField("act_quantity")
    private Long actQuantity;

    @TableField("act_winrate")
    private Double actWinrate;

    @TableField("department_no")
    private String departmentNo;

    @TableField("project_no")
    private String projectNo;

    public Integer getId()
    {
        return id;
    }

    public void setId(Integer id)
    {
        this.id = id;
    }

    public BigDecimal getBooking()
    {
        return booking;
    }

    public void setBooking(BigDecimal booking)
    {
        this.booking = booking;
    }

    public BigDecimal getRevenue()
    {
        return revenue;
    }

    public void setRevenue(BigDecimal revenue)
    {
        this.revenue = revenue;
    }

    public Long getActQuantity()
    {
        return actQuantity;
    }

    public void setActQuantity(Long actQuantity)
    {
        this.actQuantity = actQuantity;
    }

    public Double getActWinrate()
    {
        return actWinrate;
    }

    public void setActWinrate(Double actWinrate)
    {
        this.actWinrate = actWinrate;
    }

    public String getDepartmentNo()
    {
        return departmentNo;
    }

    public void setDepartmentNo(String departmentNo)
    {
        this.departmentNo = departmentNo;
    }

    public String getProjectNo()
    {
        return projectNo;
    }

    public void setProjectNo(String projectNo)
    {
        this.projectNo = projectNo;
    }

    @Override
    protected Serializable pkVal()
    {
        return this.id;
    }

    @Override
    public String toString()
    {
        return "ActualAmount{" +
                ", id=" + id +
                ", booking=" + booking +
                ", revenue=" + revenue +
                ", actQuantity=" + actQuantity +
                ", actWinrate=" + actWinrate +
                ", departmentNo=" + departmentNo +
                ", projectNo=" + projectNo +
                "}";
    }

    public static void main(String[] args)
    {
        String jsonstr = "{\n" +
                "    \"jsonrpc\": \"2.0\",\n" +
                "    \"id\": 1581468566,\n" +
                "    \"result\": {\n" +
                "        \"msg\": \"\",\n" +
                "        \"code\": 0,\n" +
                "        \"data\": {\n" +
                "            \"query_data\": [\n" +
                "                [\n" +
                "                    \"employee_number\",\n" +
                "                    \"name\",\n" +
                "                    \"department_id.department_code\",\n" +
                "                    \"department_id.name\",\n" +
                "                    \"job_id.job_code\",\n" +
                "                    \"job_id.name\",\n" +
                "                    \"parent_id.employee_number\",\n" +
                "                    \"country_id.name\",\n" +
                "                    \"work_activity\",\n" +
                "                    \"is_clt\",\n" +
                "                    \"not_update_bu\",\n" +
                "                    \"hiredate\",\n" +
                "                    \"x_job_family_group\",\n" +
                "                    \"x_job_family\",\n" +
                "                    \"employee_group_rep.code\",\n" +
                "                    \"employee_group_rep.display_name\",\n" +
                "                    \"work_email\",\n" +
                "                    \"work_phone\",\n" +
                "                    \"mobile_phone\"\n" +
                "                ]\n" +
                "\t\t ],\n" +
                "            \"model\": \"hr.employee\"\n" +
                "        }\n" +
                "    }\n" +
                "}";
        JSONObject rootObject = JSON.parseObject(jsonstr);
        JSONObject resultObject = rootObject.getJSONObject("result");
        JSONObject dataObject = resultObject.getJSONObject("data");
        JSONArray jsonArray = dataObject.getJSONArray("query_data");
        for (Object json : jsonArray)
        {
            String jsonArray2 = JSON.toJSONString(json);
            JSONArray jsonArray3 = JSONArray.parseArray(jsonArray2);
            for (Object json2 : jsonArray3)
            {
                String rootObject2 = JSON.toJSONString(json2);
                System.out.println(rootObject2);
            }
        }
    }
}